#include<bits/stdc++.h> 
using namespace std;

int main() {
    int t;
    cin >> t;
    while (t--) {
        int n;
        cin >> n;
        vector<int> a(n);
        for (auto& x:a) cin >> x;
        sort(a.begin(), a.end());
        int pos = n;
        for (int i = 0; i < n; ++i) {
            for (int j = i; j < n; ++j) {
                if ((a[i] + a[j]) % 2 == 0) {
                    pos = min(pos, n - (j - i + 1));
                }
            }
        }
        cout << pos << endl;
    }
    return 0;
}
